Reset in ANSIColor sets the background to black

Reset in ANSIColor sets the background to black

am 26.03.2009 23:17:01 von Perl Help

--===============1968950480==
Content-Type: multipart/alternative; boundary=0016e64654cab2cdb804660cf985

--0016e64654cab2cdb804660cf985
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi,

My current DOS background color is white with Black text. I use ANSIColor
module to print error messages in Red color. I use the Color command and I
face two issues:

1. The Red color error message text thats printed on DOS has black
background, instead of white only.
2. On typing CLS the background color changes to black and text color
changes to white.

What is my Expectation:
1. On prinitng the text in red color should not have the background color
black but use the current DOS background color(White in my case).

2. On doing CLS on DOS, the dos should maintain its background color(White
in my case) rather then setting it to default black background color.

My Code:
use Win32::Console::ANSI;
use Term::ANSIColor;
print color "Bold Red";
print "ERROR_MSG = xyz";
print color 'reset';

Any help is much appreciated.

Thanks,
Jai!

--0016e64654cab2cdb804660cf985
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi,

My current DOS background color is white with Black text. I
use ANSIColor module to print error messages in Red color. I use the
Color command and I face two issues:

1. The Red color error message text thats printed on DOS has black background, instead of white only.

2. On typing CLS the background color changes to black and text color changes to white.

What is my Expectation:
1.
On prinitng the text in red color should not have the background color
black but use the current DOS background color(White in my case).


2. On doing CLS on DOS, the dos should maintain its background
color(White in my case) rather then setting it to default black
background color.

My Code:
use Win32::Console::ANSI;
use Term::ANSIColor;

print color "Bold Red";
print "ERROR_MSG = xyz";
print color 'reset';

Any help is much appreciated.

Thanks,
Jai!

--0016e64654cab2cdb804660cf985--

--===============1968950480==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1968950480==--

Re: Reset in ANSIColor sets the background to black

am 26.03.2009 23:53:23 von Bill Luebkert

Perl Help wrote:
> Hi,
>
> My current DOS background color is white with Black text. I use
> ANSIColor module to print error messages in Red color. I use the Color
> command and I face two issues:
>
> 1. The Red color error message text thats printed on DOS has black
> background, instead of white only.
> 2. On typing CLS the background color changes to black and text color
> changes to white.
>
> What is my Expectation:
> 1. On prinitng the text in red color should not have the background
> color black but use the current DOS background color(White in my case).
>
> 2. On doing CLS on DOS, the dos should maintain its background
> color(White in my case) rather then setting it to default black
> background color.
>
> My Code:
> use Win32::Console::ANSI;
> use Term::ANSIColor;
> print color "Bold Red";
> print "ERROR_MSG = xyz";
> print color 'reset';

Seems OK to me on 5.8.8 B820. 5.001 & 5.006 on the modules, resp.

> p test.pl [switched my FG/BG to reverse (black on white) prior to test
Prior to error [black on white]
ERROR_MSG = xyz [this was red on white]
Done [black on white]

Everything came out fine as near as I can tell.

My code:

use strict;
use warnings;
use Win32::Console::ANSI;
use Term::ANSIColor;

print "Prior to error\n";
print color "Bold Red";
print "ERROR_MSG = xyz\n";
print color 'reset';
print "Done\n";

__END__

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Reset in ANSIColor sets the background to black

am 27.03.2009 04:33:27 von Perl Help

--===============1485487120==
Content-Type: multipart/alternative; boundary=001636284c745285da04661165e5

--001636284c745285da04661165e5
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi Bill,

Thanks for your response. DId you try running CLS command after executing
the code. When I do that, it switches my FG/BG color to default that is
White on Black. More so, my code is not showing the same results as you
described. Is there any other file I need to take care off? Do you want me
to send you the screen shot how it looks like when I run the program?

Thanks once again for your help,

~Jai!

On Thu, Mar 26, 2009 at 3:53 PM, Bill Luebkert wrote:

> Perl Help wrote:
>
>> Hi,
>>
>> My current DOS background color is white with Black text. I use ANSIColor
>> module to print error messages in Red color. I use the Color command and I
>> face two issues:
>>
>> 1. The Red color error message text thats printed on DOS has black
>> background, instead of white only.
>> 2. On typing CLS the background color changes to black and text color
>> changes to white.
>>
>> What is my Expectation:
>> 1. On prinitng the text in red color should not have the background color
>> black but use the current DOS background color(White in my case).
>>
>> 2. On doing CLS on DOS, the dos should maintain its background color(White
>> in my case) rather then setting it to default black background color.
>>
>> My Code:
>> use Win32::Console::ANSI;
>> use Term::ANSIColor;
>> print color "Bold Red";
>> print "ERROR_MSG = xyz";
>> print color 'reset';
>>
>
> Seems OK to me on 5.8.8 B820. 5.001 & 5.006 on the modules, resp.
>
> > p test.pl [switched my FG/BG to reverse (black on white)
> prior to test
> Prior to error [black on white]
> ERROR_MSG = xyz [this was red on white]
> Done [black on white]
>
> Everything came out fine as near as I can tell.
>
> My code:
>
> use strict;
> use warnings;
> use Win32::Console::ANSI;
> use Term::ANSIColor;
>
> print "Prior to error\n";
> print color "Bold Red";
> print "ERROR_MSG = xyz\n";
> print color 'reset';
> print "Done\n";
>
> __END__
>
>

--001636284c745285da04661165e5
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Bill,

Thanks for your response. DId you try running CLS command a=
fter executing the code. When I do that, it switches my FG/BG color to defa=
ult that is White on Black. More so, my code is not showing the same result=
s as you described. Is there any other file I need to take care off? Do you=
want me to send you the screen shot how it looks like when I run the progr=
am?


Thanks once again for your help,

~Jai!

l_quote">On Thu, Mar 26, 2009 at 3:53 PM, Bill Luebkert &=
lt;>=
wrote:

204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<=
div class=3D"h5">Perl Help wrote:

204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,



My current DOS background color is white with Black text. I use ANSIColor m=
odule to print error messages in Red color. I use the Color command and I f=
ace two issues:



1. The Red color error message text thats printed on DOS has black backgrou=
nd, instead of white only.

2. On typing CLS the background color changes to black and text color chang=
es to white.



What is my Expectation:

1. On prinitng the text in red color should not have the background color b=
lack but use the current DOS background color(White in my case).



2. On doing CLS on DOS, the dos should maintain its background color(White =
in my case) rather then setting it to default black background color.



My Code:

use Win32::Console::ANSI;

use Term::ANSIColor;

print color "Bold Red";

print "ERROR_MSG =3D xyz";

print color 'reset';




Seems OK to me on 5.8.8 B820. =A05.001 & 5.006 on the modules, resp. >


> p test.pl =A0 =A0 =A0 =A0 =A0 =A0 [switched my FG/BG to reverse (black=
on white) prior to test

Prior to error =A0 =A0 =A0 =A0 =A0[black on white]

ERROR_MSG =3D xyz =A0 =A0 =A0 =A0 [this was red on white]

Done =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[black on white]



Everything came out fine as near as I can tell.



My code:



use strict;

use warnings;


use Win32::Console::ANSI;

use Term::ANSIColor;



print "Prior to error\n";

print color "Bold Red";

print "ERROR_MSG =3D xyz\n";

print color 'reset';

print "Done\n";



__END__






--001636284c745285da04661165e5--

--===============1485487120==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1485487120==--

RE: Reset in ANSIColor sets the background to black

am 27.03.2009 15:01:14 von Erich.Singer

This is a multi-part message in MIME format.

--===============0016091931==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C9AEE4.6A03F6EA"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C9AEE4.6A03F6EA
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

Hello
=20
Please try
=20
Thanks
Erich
=20
use strict;
use warnings;
use Win32::Console::ANSI;
use Term::ANSIColor;
use Term::ANSIScreen qw/:color :cursor :screen/;
color 'bold green on blue';
print "\nPrior to error\n";
print colored ("\nThis is an error\n", 'bold red',);
color 'bold green on blue';
print "\nAfter error\n";
__END__


________________________________

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of Perl
Help
Sent: Thursday, March 26, 2009 11:33 PM
To: Bill Luebkert
Cc: activeperl@listserv.activestate.com
Subject: Re: Reset in ANSIColor sets the background to black


Hi Bill,

Thanks for your response. DId you try running CLS command after
executing the code. When I do that, it switches my FG/BG color to
default that is White on Black. More so, my code is not showing the same
results as you described. Is there any other file I need to take care
off? Do you want me to send you the screen shot how it looks like when I
run the program?

Thanks once again for your help,

~Jai!


On Thu, Mar 26, 2009 at 3:53 PM, Bill Luebkert
wrote:


Perl Help wrote:
=09

Hi,
=09
My current DOS background color is white with Black
text. I use ANSIColor module to print error messages in Red color. I use
the Color command and I face two issues:
=09
1. The Red color error message text thats printed on DOS
has black background, instead of white only.
2. On typing CLS the background color changes to black
and text color changes to white.
=09
What is my Expectation:
1. On prinitng the text in red color should not have the
background color black but use the current DOS background color(White in
my case).
=09
2. On doing CLS on DOS, the dos should maintain its
background color(White in my case) rather then setting it to default
black background color.
=09
My Code:
use Win32::Console::ANSI;
use Term::ANSIColor;
print color "Bold Red";
print "ERROR_MSG =3D xyz";
print color 'reset';
=09


Seems OK to me on 5.8.8 B820. 5.001 & 5.006 on the modules,
resp.
=09
> p test.pl [switched my FG/BG to reverse (black on
white) prior to test
Prior to error [black on white]
ERROR_MSG =3D xyz [this was red on white]
Done [black on white]
=09
Everything came out fine as near as I can tell.
=09
My code:
=09
use strict;
use warnings;=20

use Win32::Console::ANSI;
use Term::ANSIColor;
=09
=09
print "Prior to error\n";
print color "Bold Red";
print "ERROR_MSG =3D xyz\n";
print color 'reset';
print "Done\n";
=09
__END__
=09
=09



------_=_NextPart_001_01C9AEE4.6A03F6EA
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable



charset=3Dus-ascii">


size=3D2> class=3D390445913-27032009>Hello

size=3D2> class=3D390445913-27032009> 

size=3D2> class=3D390445913-27032009>Please try

size=3D2> class=3D390445913-27032009> 

size=3D2> class=3D390445913-27032009>Thanks

size=3D2> class=3D390445913-27032009>Erich

size=3D2> 

size=3D2>use strict;
use=20
warnings;
use Win32::Console::ANSI;
use Term::ANSIColor;
use=20
Term::ANSIScreen qw/:color :cursor :screen/;
color 'bold green on=20
blue';
print "\nPrior to error\n";
print colored ("\nThis is an =
error\n",=20
'bold red',);
color 'bold green on blue';
print "\nAfter=20
error\n";
__END__





From:=20
activeperl-bounces@listserv.ActiveState.com=20
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of =
Perl=20
Help
Sent: Thursday, March 26, 2009 11:33 PM
To: =
Bill=20
Luebkert
Cc: =
activeperl@listserv.activestate.com
Subject:=20
Re: Reset in ANSIColor sets the background to black


Hi Bill,

Thanks for your response. DId you try running =
CLS=20
command after executing the code. When I do that, it switches my FG/BG =
color to=20
default that is White on Black. More so, my code is not showing the same =
results=20
as you described. Is there any other file I need to take care off? Do =
you want=20
me to send you the screen shot how it looks like when I run the=20
program?

Thanks once again for your help,

~Jai!


On Thu, Mar 26, 2009 at 3:53 PM, Bill Luebkert =
dir=3Dltr>< href=3D"mailto:dbecoll@roadrunner.com">dbecoll@roadrunner.co m> AN>=20
wrote:

style=3D"PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: =
rgb(204,204,204) 1px solid">


Perl Help wrote:

style=3D"PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: =
rgb(204,204,204) 1px solid">Hi,

My=20
current DOS background color is white with Black text. I use =
ANSIColor=20
module to print error messages in Red color. I use the Color command =
and I=20
face two issues:

1. The Red color error message text thats =
printed on=20
DOS has black background, instead of white only.
2. On typing CLS =
the=20
background color changes to black and text color changes to=20
white.

What is my Expectation:
1. On prinitng the text in =
red=20
color should not have the background color black but use the current =
DOS=20
background color(White in my case).

2. On doing CLS on DOS, =
the dos=20
should maintain its background color(White in my case) rather then =
setting=20
it to default black background color.

My Code:
use=20
Win32::Console::ANSI;
use Term::ANSIColor;
print color "Bold=20
Red";
print "ERROR_MSG =3D xyz";
print color=20
'reset';

Seems OK to me on 5.8.8 B820. =

 5.001 & 5.006 on the modules, resp.

> p test.pl =
 =20
          [switched my FG/BG to reverse =
(black on=20
white) prior to test
Prior to error        =20
 [black on white]
ERROR_MSG =3D xyz       =
  [this=20
was red on white]
Done             =
 =20
     [black on white]

Everything came out fine =
as near=20
as I can tell.

My code:

use strict;
use warnings;

use Win32::Console::ANSI;
use=20
Term::ANSIColor;

print "Prior to error\n";
print color =
"Bold=20
Red";
print "ERROR_MSG =3D xyz\n";
print color 'reset';
print =

"Done\n";

__END__




------_=_NextPart_001_01C9AEE4.6A03F6EA--

--===============0016091931==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0016091931==--

Re: Reset in ANSIColor sets the background to black

am 27.03.2009 19:37:24 von Bill Luebkert

Perl Help wrote:
> Hi Bill,
>
> Thanks for your response. DId you try running CLS command after
> executing the code. When I do that, it switches my FG/BG color to
> default that is White on Black. More so, my code is not showing the same
> results as you described. Is there any other file I need to take care
> off? Do you want me to send you the screen shot how it looks like when I
> run the program?

OK, my mistake for not stating all. I ran it in a tcsh window rather
than a cmd window. When I try it in a cmd window, I get the same results
as you described. I'm so used to using tcsh rather than cmd, it didn't
even register that I wasn't reproducing the scenario exactly. So it
looks like there is a problem somewhere - maybe there's a workaround,
but I don't know.

You could always switch to tcsh (maybe bash would work too). :)
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Reset in ANSIColor sets the background to black

am 27.03.2009 20:12:03 von Perl Help

--===============1930464365==
Content-Type: multipart/alternative; boundary=0016e6476a0205ec0c04661e8224

--0016e6476a0205ec0c04661e8224
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi,

I tried this code, but it shows the same results in cmd.exe. Also, is there
a way I can read the current background and foreground color of dos window
from perl?

Thanks,
Jai!

On Fri, Mar 27, 2009 at 7:01 AM, Singer, Erich <
Erich.Singer@starcompliance.com> wrote:

> Hello
>
> Please try
>
> Thanks
> Erich
>
> use strict;
> use warnings;
> use Win32::Console::ANSI;
> use Term::ANSIColor;
> use Term::ANSIScreen qw/:color :cursor :screen/;
> color 'bold green on blue';
> print "\nPrior to error\n";
> print colored ("\nThis is an error\n", 'bold red',);
> color 'bold green on blue';
> print "\nAfter error\n";
> __END__
>
> ------------------------------
> *From:* activeperl-bounces@listserv.ActiveState.com [mailto:
> activeperl-bounces@listserv.ActiveState.com] *On Behalf Of *Perl Help
> *Sent:* Thursday, March 26, 2009 11:33 PM
> *To:* Bill Luebkert
> *Cc:* activeperl@listserv.activestate.com
> *Subject:* Re: Reset in ANSIColor sets the background to black
>
> Hi Bill,
>
> Thanks for your response. DId you try running CLS command after executing
> the code. When I do that, it switches my FG/BG color to default that is
> White on Black. More so, my code is not showing the same results as you
> described. Is there any other file I need to take care off? Do you want me
> to send you the screen shot how it looks like when I run the program?
>
> Thanks once again for your help,
>
> ~Jai!
>
> On Thu, Mar 26, 2009 at 3:53 PM, Bill Luebkert wrote:
>
>> Perl Help wrote:
>>
>>> Hi,
>>>
>>> My current DOS background color is white with Black text. I use ANSIColor
>>> module to print error messages in Red color. I use the Color command and I
>>> face two issues:
>>>
>>> 1. The Red color error message text thats printed on DOS has black
>>> background, instead of white only.
>>> 2. On typing CLS the background color changes to black and text color
>>> changes to white.
>>>
>>> What is my Expectation:
>>> 1. On prinitng the text in red color should not have the background color
>>> black but use the current DOS background color(White in my case).
>>>
>>> 2. On doing CLS on DOS, the dos should maintain its background
>>> color(White in my case) rather then setting it to default black background
>>> color.
>>>
>>> My Code:
>>> use Win32::Console::ANSI;
>>> use Term::ANSIColor;
>>> print color "Bold Red";
>>> print "ERROR_MSG = xyz";
>>> print color 'reset';
>>>
>>
>> Seems OK to me on 5.8.8 B820. 5.001 & 5.006 on the modules, resp.
>>
>> > p test.pl [switched my FG/BG to reverse (black on white)
>> prior to test
>> Prior to error [black on white]
>> ERROR_MSG = xyz [this was red on white]
>> Done [black on white]
>>
>> Everything came out fine as near as I can tell.
>>
>> My code:
>>
>> use strict;
>> use warnings;
>> use Win32::Console::ANSI;
>> use Term::ANSIColor;
>>
>> print "Prior to error\n";
>> print color "Bold Red";
>> print "ERROR_MSG = xyz\n";
>> print color 'reset';
>> print "Done\n";
>>
>> __END__
>>
>>
>

--0016e6476a0205ec0c04661e8224
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,

I tried this code, but it shows the same results in cmd.exe. Als=
o, is there a way I can read the current background and foreground color of=
dos window from perl?

Thanks,
Jai!

ote">
On Fri, Mar 27, 2009 at 7:01 AM, Singer, Erich < f=3D"mailto:Erich.Singer@starcompliance.com">Erich.Singer@st arcompliance.co=
m
>
wrote:
r-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-le=
ft: 1ex;">





Arial">Hello

Arial">=A0

Arial">Please try

Arial">=A0

Arial">Thanks

Arial">Erich

Arial">=A0

Arial">
use strict;
use=20
warnings;
use Win32::Console::ANSI;
use Term::ANSIColor;
use=
=20
Term::ANSIScreen qw/:color :cursor :screen/;
color 'bold green on=20
blue';
print "\nPrior to error\n";
print colored ("=
;\nThis is an error\n",=20
'bold red',);
color 'bold green on blue';
print "=
;\nAfter=20
error\n";
__END__





From:=20
lank">activeperl-bounces@listserv.ActiveState.com=20
[mailto: et=3D"_blank">activeperl-bounces@listserv.ActiveState.com] On Behalf=
Of
Perl=20
Help
Sent: Thursday, March 26, 2009 11:33 PM
To: Bill=
=20
Luebkert
Cc: m" target=3D"_blank">activeperl@listserv.activestate.com
Subject:=
=20
Re: Reset in ANSIColor sets the background to black

v>

Hi Bill,

Thanks for your response. DId you try running CL=
S=20
command after executing the code. When I do that, it switches my FG/BG colo=
r to=20
default that is White on Black. More so, my code is not showing the same re=
sults=20
as you described. Is there any other file I need to take care off? Do you w=
ant=20
me to send you the screen shot how it looks like when I run the=20
program?

Thanks once again for your help,

~Jai!


On Thu, Mar 26, 2009 at 3:53 PM, Bill Luebkert <=
span dir=3D"ltr">< lank">dbecoll@roadrunner.com>=20
wrote:

204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


Perl Help wrote:

, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,

My=
=20
current DOS background color is white with Black text. I use ANSIColor=
=20
module to print error messages in Red color. I use the Color command an=
d I=20
face two issues:

1. The Red color error message text thats print=
ed on=20
DOS has black background, instead of white only.
2. On typing CLS th=
e=20
background color changes to black and text color changes to=20
white.

What is my Expectation:
1. On prinitng the text in red=
=20
color should not have the background color black but use the current DO=
S=20
background color(White in my case).

2. On doing CLS on DOS, the =
dos=20
should maintain its background color(White in my case) rather then sett=
ing=20
it to default black background color.

My Code:
use=20
Win32::Console::ANSI;
use Term::ANSIColor;
print color "Bold=
=20
Red";
print "ERROR_MSG =3D xyz";
print color=20
'reset';

Seems OK to me on 5.8.8 =
B820.=20
=A05.001 & 5.006 on the modules, resp.

> p test.pl  
=A0 =A0 =A0 =A0 =A0 [switched my FG/BG to reverse (black on=20
white) prior to test
Prior to error =A0 =A0 =A0  
=A0[black on white]
ERROR_MSG =3D xyz =A0 =A0 =A0 =A0 [this=20
was red on white]
Done =A0 =A0 =A0 =A0 =A0 =A0  
=A0 =A0 =A0[black on white]

Everything came out fine as near=20
as I can tell.

My code:

use strict;
use warnings;

use Win32::Console::ANSI;
use=20
Term::ANSIColor;

print "Prior to error\n";
prin=
t color "Bold=20
Red";
print "ERROR_MSG =3D xyz\n";
print color '=
reset';
print=20
"Done\n";

__END__


div>




--0016e6476a0205ec0c04661e8224--

--===============1930464365==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1930464365==--

RE: Reset in ANSIColor sets the background to black

am 27.03.2009 20:31:53 von Erich.Singer

This is a multi-part message in MIME format.

--===============0975741388==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C9AF12.9B06ABE0"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C9AF12.9B06ABE0
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

=20
Hello
=20
I am using ver 5.10.0.
In the example, I ignore the current background and foreground colors (
because I do not know how to get them...) and force a bold green on a
blue background. Error messages should be bold red on a blue background.
I have added the code in bold e.g. system ("cls");=20
Issue the color changes at the beginning of your program, and this way
you minimize the effect of the cls command, e.g. you do not loose too
much data already displayed on the screen
=20
HTH
=20
Erich
=20
use strict;
use warnings;
use Win32::Console::ANSI;
use Term::ANSIColor;
use Term::ANSIScreen qw/:color :cursor :screen/;
color 'bold green on blue';
system ("cls");
print "\nPrior to error\n";
print colored ("\nThis is an error\n", 'bold red',);
color 'bold green on blue';
print "\nAfter error\n";
__END__

=20

________________________________

From: Perl Help [mailto:perlhelp60@gmail.com]=20
Sent: Friday, March 27, 2009 3:12 PM
To: Singer, Erich
Cc: Bill Luebkert; activeperl@listserv.activestate.com
Subject: Re: Reset in ANSIColor sets the background to black


Hi,

I tried this code, but it shows the same results in cmd.exe. Also, is
there a way I can read the current background and foreground color of
dos window from perl?

Thanks,
Jai!


On Fri, Mar 27, 2009 at 7:01 AM, Singer, Erich
wrote:


Hello
=20
Please try
=20
Thanks
Erich
=20
=09
use strict;
use warnings;
use Win32::Console::ANSI;
use Term::ANSIColor;
=09
use Term::ANSIScreen qw/:color :cursor :screen/;
color 'bold green on blue';
print "\nPrior to error\n";
print colored ("\nThis is an error\n", 'bold red',);
color 'bold green on blue';
print "\nAfter error\n";
__END__
=09

________________________________

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of Perl
Help
Sent: Thursday, March 26, 2009 11:33 PM
To: Bill Luebkert
Cc: activeperl@listserv.activestate.com
Subject: Re: Reset in ANSIColor sets the background to black
=09
=09
Hi Bill,
=09
Thanks for your response. DId you try running CLS command after
executing the code. When I do that, it switches my FG/BG color to
default that is White on Black. More so, my code is not showing the same
results as you described. Is there any other file I need to take care
off? Do you want me to send you the screen shot how it looks like when I
run the program?
=09
Thanks once again for your help,
=09
~Jai!
=09
=09
On Thu, Mar 26, 2009 at 3:53 PM, Bill Luebkert
wrote:
=09

Perl Help wrote:
=09

Hi,
=09
My current DOS background color is white with
Black text. I use ANSIColor module to print error messages in Red color.
I use the Color command and I face two issues:
=09
1. The Red color error message text thats
printed on DOS has black background, instead of white only.
2. On typing CLS the background color changes to
black and text color changes to white.
=09
What is my Expectation:
1. On prinitng the text in red color should not
have the background color black but use the current DOS background
color(White in my case).
=09
2. On doing CLS on DOS, the dos should maintain
its background color(White in my case) rather then setting it to default
black background color.
=09
My Code:
use Win32::Console::ANSI;
use Term::ANSIColor;
print color "Bold Red";
print "ERROR_MSG =3D xyz";
print color 'reset';
=09


Seems OK to me on 5.8.8 B820. 5.001 & 5.006 on the
modules, resp.
=09
> p test.pl [switched my FG/BG to reverse
(black on white) prior to test
Prior to error [black on white]
ERROR_MSG =3D xyz [this was red on white]
Done [black on white]
=09
Everything came out fine as near as I can tell.
=09
My code:
=09
use strict;
use warnings;=20

use Win32::Console::ANSI;
use Term::ANSIColor;
=09
=09
print "Prior to error\n";
print color "Bold Red";
print "ERROR_MSG =3D xyz\n";
print color 'reset';
print "Done\n";
=09
__END__
=09
=09




------_=_NextPart_001_01C9AF12.9B06ABE0
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable



charset=3Dus-ascii">


size=3D2> 

size=3D2> class=3D390521819-27032009>Hello

size=3D2> class=3D390521819-27032009> 

size=3D2> class=3D390521819-27032009>I am using ver 5.10.0.

size=3D2> class=3D390521819-27032009>In the example, I ignore the current =
background and=20
foreground colors ( because I do not know how to get them...) and force =
a bold=20
green on a blue background. Error messages should be bold red on a blue=20
background.

size=3D2> class=3D390521819-27032009>
size=3D2> class=3D390521819-27032009>I have added the code in bold e.g. system =
("cls");=20

size=3D2> class=3D390521819-27032009>Issue the color changes at the beginning of =
your=20
program, and this way you minimize the effect of the cls command, e.g. =
you do=20
not loose too much data already displayed on the =
screen

size=3D2> class=3D390521819-27032009> 
=

size=3D2> class=3D390521819-27032009>HTH

size=3D2> class=3D390521819-27032009> 

size=3D2> class=3D390521819-27032009>Erich

size=3D2> 

size=3D2>use strict;
use=20
warnings;
use Win32::Console::ANSI;
use Term::ANSIColor;
use=20
Term::ANSIScreen qw/:color :cursor :screen/;
color 'bold green on=20
blue';
system ("cls");
print "\nPrior to =

error\n";
print colored ("\nThis is an error\n", 'bold =
red',);
color 'bold=20
green on blue';
print "\nAfter error\n";
__END__

size=3D2> 





From: Perl Help =
[mailto:perlhelp60@gmail.com]=20

Sent: Friday, March 27, 2009 3:12 PM
To: Singer,=20
Erich
Cc: Bill Luebkert;=20
activeperl@listserv.activestate.com
Subject: Re: Reset in =
ANSIColor=20
sets the background to black


Hi,

I tried this code, but it shows the same results =
in=20
cmd.exe. Also, is there a way I can read the current background and =
foreground=20
color of dos window from perl?

Thanks,
Jai!


On Fri, Mar 27, 2009 at 7:01 AM, Singer, Erich =
dir=3Dltr>< href=3D"mailto:Erich.Singer@starcompliance.com">Erich.Singer @starcomplian=
ce.com>=20
wrote:

style=3D"PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: =
rgb(204,204,204) 1px solid">

size=3D2>Hello

size=3D2> 

size=3D2>Please=20
try

size=3D2> 

size=3D2>Thanks

size=3D2>Erich

size=3D2> 

size=3D2>
use strict;
use warnings;
use =
Win32::Console::ANSI;
use=20
Term::ANSIColor;
use Term::ANSIScreen qw/:color :cursor=20
:screen/;
color 'bold green on blue';
print "\nPrior to=20
error\n";
print colored ("\nThis is an error\n", 'bold =
red',);
color=20
'bold green on blue';
print "\nAfter=20
error\n";
__END__





From: href=3D"mailto:activeperl-bounces@listserv.ActiveState.com"= 20
target=3D_blank>activeperl-bounces@listserv.ActiveState.com =
[mailto: href=3D"mailto:activeperl-bounces@listserv.ActiveState.com"= 20
target=3D_blank>activeperl-bounces@listserv.ActiveState.com] On =
Behalf Of=20
Perl Help
Sent: Thursday, March 26, 2009 11:33 =
PM
To:=20
Bill Luebkert
Cc: href=3D"mailto:activeperl@listserv.activestate.com"=20
=
target=3D_blank>activeperl@listserv.activestate.com
Subject: > Re:=20
Reset in ANSIColor sets the background to black





Hi Bill,

Thanks for your response. DId you try =
running CLS=20
command after executing the code. When I do that, it switches my FG/BG =
color=20
to default that is White on Black. More so, my code is not showing the =
same=20
results as you described. Is there any other file I need to take care =
off? Do=20
you want me to send you the screen shot how it looks like when I run =
the=20
program?

Thanks once again for your help,

~Jai!


On Thu, Mar 26, 2009 at 3:53 PM, Bill =
Luebkert dir=3Dltr>< target=3D_blank>dbecoll@roadrunner.com> wrote:

style=3D"PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: =
rgb(204,204,204) 1px solid">


Perl Help wrote:

style=3D"PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: =
rgb(204,204,204) 1px solid">Hi,

My=20
current DOS background color is white with Black text. I use =
ANSIColor=20
module to print error messages in Red color. I use the Color =
command and I=20
face two issues:

1. The Red color error message text thats =
printed=20
on DOS has black background, instead of white only.
2. On =
typing CLS=20
the background color changes to black and text color changes to=20
white.

What is my Expectation:
1. On prinitng the text =
in red=20
color should not have the background color black but use the =
current DOS=20
background color(White in my case).

2. On doing CLS on DOS, =
the dos=20
should maintain its background color(White in my case) rather then =
setting=20
it to default black background color.

My Code:
use=20
Win32::Console::ANSI;
use Term::ANSIColor;
print color "Bold =

Red";
print "ERROR_MSG =3D xyz";
print color=20
'reset';

Seems OK to me on 5.8.8 =
B820.=20
 5.001 & 5.006 on the modules, resp.

> p test.pl =
 =20
          [switched my FG/BG to reverse =
(black on=20
white) prior to test
Prior to error        =20
 [black on white]
ERROR_MSG =3D xyz       =
  [this=20
was red on white]
Done             =
 =20
     [black on white]

Everything came out fine =
as near=20
as I can tell.

My code:

use strict;
use warnings;=20

use Win32::Console::ANSI;
use=20
Term::ANSIColor;

print "Prior to error\n";
print =
color "Bold=20
Red";
print "ERROR_MSG =3D xyz\n";
print color =
'reset';
print=20
=
"Done\n";

__END__


=



------_=_NextPart_001_01C9AF12.9B06ABE0--

--===============0975741388==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0975741388==--

Re: Reset in ANSIColor sets the background to black

am 27.03.2009 21:45:24 von Bill Luebkert

Perl Help wrote:
> Hi,
>
> I tried this code, but it shows the same results in cmd.exe. Also, is
> there a way I can read the current background and foreground color of
> dos window from perl?

Not sure if it's in a module, but you can use Win32::API to get it from
GetConsoleScreenBufferInfo function.

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Reset in ANSIColor sets the background to black

am 28.03.2009 20:31:24 von Perl Help

The following code gets the DOS current background and foreground
color information and prints the error message in red color and then
sets the text color back to original without changing its background
color.

use strict;
use warnings;
use Win32::Console;

my $console = Win32::Console->new(STD_OUTPUT_HANDLE);
my $CurrentConsoleColor = $console->Attr;
my $BackgroundColor = $CurrentConsoleColor &
(BACKGROUND_RED|BACKGROUND_BLUE|BACKGROUND_GREEN|BACKGROUND_ INTENSITY);
print "\nPrior to error: \n";
# This sets the text color on DOS in red with intensity
$console->Attr(FOREGROUND_RED|FOREGROUND_INTENSITY|$Backgrou ndColor);
print "\nError Msg: xyz \n";
$console->Attr($CurrentConsoleColor);
print "\nAfter error\n";

Thanks,
Jai!

On 3/27/09, Bill Luebkert wrote:
> Perl Help wrote:
>> Hi,
>>
>> I tried this code, but it shows the same results in cmd.exe. Also, is
>> there a way I can read the current background and foreground color of
>> dos window from perl?
>
> Not sure if it's in a module, but you can use Win32::API to get it from
> GetConsoleScreenBufferInfo function.
>
>
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Reset in ANSIColor sets the background to black

am 30.03.2009 15:00:42 von Erich.Singer

Good Morning

Thanks for posting your solution

Erich

-----Original Message-----
From: Perl Help [mailto:perlhelp60@gmail.com]
Sent: Saturday, March 28, 2009 3:31 PM
To: Bill Luebkert; Singer, Erich
Cc: activeperl@listserv.activestate.com
Subject: Re: Reset in ANSIColor sets the background to black

The following code gets the DOS current background and foreground color
information and prints the error message in red color and then sets the
text color back to original without changing its background color.

use strict;
use warnings;
use Win32::Console;

my $console = Win32::Console->new(STD_OUTPUT_HANDLE);
my $CurrentConsoleColor = $console->Attr; my $BackgroundColor =
$CurrentConsoleColor &
(BACKGROUND_RED|BACKGROUND_BLUE|BACKGROUND_GREEN|BACKGROUND_ INTENSITY);
print "\nPrior to error: \n";
# This sets the text color on DOS in red with intensity
$console->Attr(FOREGROUND_RED|FOREGROUND_INTENSITY|$Backgrou ndColor);
print "\nError Msg: xyz \n";
$console->Attr($CurrentConsoleColor);
print "\nAfter error\n";

Thanks,
Jai!

On 3/27/09, Bill Luebkert wrote:
> Perl Help wrote:
>> Hi,
>>
>> I tried this code, but it shows the same results in cmd.exe. Also, is

>> there a way I can read the current background and foreground color of

>> dos window from perl?
>
> Not sure if it's in a module, but you can use Win32::API to get it
> from GetConsoleScreenBufferInfo function.
>
>
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs